package cate.game.play.skill.passive.hero;

import cate.game.play.config.PlayCfgArgs;
import cate.game.play.fighter.Fighter;
import cate.game.play.proce.action.ctx.ActionCtx;
import cate.game.play.skill.passive.PassiveHandler;

/**
 * 若敌方单位携带【狂鲨印记】死亡时，己方全体单位回复120%攻击的生命值
 */
public class 狂鲨掠命PH extends PassiveHandler {

	private String buff标签;

	private double 回复系数;

	//buff标签=狂鲨印记&回复系数=12000
	@Override
	public void parse(String code) {
		PlayCfgArgs args = new PlayCfgArgs(code);
		buff标签 = args.get("buff标签");
		回复系数 = args.getWDouble("回复系数", 0d);
	}

	@Override
	public void beforeOtherDead(ActionCtx action, Fighter fighter) {
		if (fighter.getTeam() == skill.owner.getTeam()) {
			return;
		}
		if (!fighter.buff.containTags(buff标签)) {
			return;
		}
		for (Fighter target : skill.owner.getFightTeam().getFightersAlive()) {
			target.attr.passiveHeal(action, skill.owner, target.attr.attTotal()*回复系数);
		}
	}
}
